<?php

namespace Biz\Mailers\Site;

use Biz\Models\User\UserMember;
use Biz\Mailers\User\Tags\UserTags;
use Biz\Mailers\App\Tags\AppSiteTags;
use Biz\Mailers\User\Tags\UserMemberTags;
use Biz\Constants\Site\SiteEmailConstants;

class SiteUserMemberRegisterMail extends SiteMailer
{
    /**
     * The subject of the message.
     *
     * @var string
     */
    public $subject = 'Registered';

    /**
     * The view to use for the message.
     *
     * @var string
     */
    public $view = 'emails.default.user.member.register';

    /**
     * Email Type.
     *
     * @var string
     */
    protected $emailType = SiteEmailConstants::TYPE_MEMBER_REGISTER;

    /**
     * UserMemberRegisterMail constructor.
     *
     * @param UserMember $userMember
     */
    public function __construct(UserMember $userMember)
    {
        // Before
        parent::__construct();

        $user       = $userMember->user;
        $this->to($user->email, $user->nickname);

        $this->pushTags(new AppSiteTags($this->getAppSite()))
            ->pushTags(new UserTags($user))
            ->pushTags(new UserMemberTags($userMember));
    }
}
